package com.hai.test.ui;

import android.os.Build;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.hai.test.R;

/**
 * fileDesc
 * Created by huanghp on 2019/12/21.
 * Email h1132760021@sina.com
 */
public class WebActivity extends AppCompatActivity {
    WebView webView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web);

        webView=findViewById(R.id.webView);
        webView.setVerticalScrollBarEnabled(false);
        webView.setHorizontalScrollBarEnabled(false);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            webView.setWebContentsDebuggingEnabled(true);
        }
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true); // 支持JS
        webSettings.setAllowFileAccess(true); // 可以访问文件
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 支持JS打开新窗口
        webSettings.setLoadsImagesAutomatically(true); // 支持自动加载图片
        webSettings.setDomStorageEnabled(true);
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setUseWideViewPort(true); // 将图片调整到适合webView的大小
        webSettings.setSupportZoom(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setDisplayZoomControls(false);
//        webView.loadUrl("http://ww.hao123.com/");
        webView.loadUrl("https://sjh.baidu.com/site/galaxy-immi.com/3abddbf0-0e8a-49e4-9413-b07982d862b0?&IDEA_ID=135240481988&stat=4iJZVLtojXpOdPIgNPVIO9wei_T75QhQUzqUJ-IsQ6Y&of=3&fid=nHDYnWTkPjDkPjnvnW6vn1fvr7tdPjuxnf&ch=3");
    }
}
